package com.zhangyi.recrprise.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhangyi.common.domain.Candidate;
import com.zhangyi.common.domain.EnterpriseRecruitment;
import com.zhangyi.common.domain.Result;
import com.zhangyi.recrprise.mapper.EnterpriceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EnterpriceServiceImpl implements EnterpriceService{
    @Autowired
    EnterpriceMapper enterpriceMapper;
    @Override
    public Result enterpricelist(EnterpriseRecruitment enterpriseRecruitment) {
        PageHelper.startPage(enterpriseRecruitment.getPageNum(),enterpriseRecruitment.getPageSize());
        List<EnterpriseRecruitment> entlist=enterpriceMapper.enterpricelistquerry(enterpriseRecruitment);
        return new Result(200,new PageInfo<>(entlist),"查询成功");
    }

    @Override
    public Result candidateslist(Candidate candidate) {
        List<Candidate>canlist=enterpriceMapper.candidateslist(candidate);
        return new Result(200,canlist,"查询成功");
    }

    @Override
    public Result add(Candidate candidate) {
        int i=enterpriceMapper.add(candidate);
        return new Result(200,i,"添加成功");
    }

    @Override
    public Result update(EnterpriseRecruitment enterpriseRecruitment) {
        int i=enterpriceMapper.update(enterpriseRecruitment);
        return new Result(200,i,"添加成功");
    }
}
